#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Datetime: 2022/9/26 11:29
# @Author  : CHENWang
# @Site    : 
# @File    : daily_index_components_update.py
# @Software: PyCharm

"""
脚本说明:
"""

from TQR_Applications.factor_database.crypto.market_index_analysis import index_component
from logger import logger
import os,traceback
from task_monitor import task_to_db,send_error_to_email

if __name__ == '__main__':
    # 板块成份获取
    logger.info("开始获取index_component")
    task_to_db(os.path.basename(__file__), 'index_component')
    try:
        index_component()
    except Exception as e:
        msg = traceback.format_exc()
        logger.info(msg)
        send_error_to_email(script_name=os.path.basename(__file__), func_name="index_component", message=msg)
        raise e
    task_to_db(os.path.basename(__file__), 'index_component', 1)
    logger.info("成功获取index_component")